/// @tags: Construction
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

constexpr int N = 1e3 + 3;

int n, R, lcnt, k, cnt;
int A[N];

inline int main() {
  cin >> n;
  k = sqrt(n);
  R = n - k - (n - 1) / k;
  if (R <= 0) {
    cout << '0';
    return 0;
  }
  while (true) {
    cout << k << ' ';
    cnt = 0;
    for (int i = 1; i <= n; ++i) {
      if (A[i] || i % k == 1) continue;
      cout << i << ' ';
      A[i] = true, ++lcnt, ++cnt;
      if (cnt == k) break;
    }
    cout << endl;
    int x;
    cin >> x;
    for (int i = 0; i <= k - 1; ++i) {
      if (A[(i + x - 1) % n + 1]) --lcnt;
      A[(i + x - 1) % n + 1] = false;
    }
    if (lcnt == R) break;
  }
  cout << '0';
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("CF1368F Lamps on a Circle.in", "r", stdin);
  freopen("CF1368F Lamps on a Circle.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
